package com.bachongLightNovel.utils;

import com.bachongLightNovel.model.pojo.system.User;

/**
 * 用户信息工具类
 * 存储本次请求的用户信息和获取本次请求的用户信息
 * @author vermouth
 */
public class UserInfoUtil {

    private static final ThreadLocal<User> THREAD_LOCAL=new ThreadLocal<>();

    public static void setUser(User user){
        THREAD_LOCAL.set(user);
    }

    public static User getUser(){
        return THREAD_LOCAL.get();
    }

    public static void removeUser(){
        THREAD_LOCAL.remove();
    }
}
